<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0">
    <title>has选择器 - 仿苹果底部doc栏</title>
    <style>
      .fc {
        display: flex;
        justify-content: center;
        align-items: center;
      }

      .doc {
        position: fixed;
        left: 0;
        bottom: 0;
        padding: 10px;
        box-sizing: border-box;
        display: flex;
        justify-content: center;
        align-items: flex-end;
        width: 100%;
        height: 80px;
        border: 1px solid pink;
      }

      .list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: flex-end;
      }

      .item {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: 1px solid lightgreen;
        transition: all ease 300ms;
        transform-origin: center bottom;
      }

      .item:hover {
        border: 1px solid green;
        width: 80px;
        height: 80px;
      }

      /* hover的item后面的那个item被选中 */
      .item:hover+.item {
        width: 60px;
        height: 60px;
      }

      /* 当前item后面如果有被hover的item，则当前item被选中 */
      .item:has(+.item:hover) {
        width: 60px;
        height: 60px;
      }
    </style>
  </head>

  <body>
    <div class="doc">
      <ul class="list">
        <li class="item fc"
            style="--idx:0">0</li>
        <li class="item fc"
            style="--idx:1">1</li>
        <li class="item fc"
            style="--idx:2">2</li>
        <li class="item fc"
            style="--idx:3">3</li>
        <li class="item fc"
            style="--idx:4">4</li>
        <li class="item fc"
            style="--idx:5">5</li>
        <li class="item fc"
            style="--idx:6">6</li>
        <li class="item fc"
            style="--idx:7">7</li>
        <li class="item fc"
            style="--idx:8">8</li>
        <li class="item fc"
            style="--idx:9">9</li>
        <li class="item fc"
            style="--idx:10">10</li>
        <li class="item fc"
            style="--idx:11">11</li>
      </ul>
    </div>

  </body>

</html>
